<!DOCTYPE html>
<html lang="zh-cn">

<head>
  <meta charset="utf-8" />
  <title>首页 - 班级博客</title>
  <%- include('./layouts/head.ejs')%>
  <style>
    #live2dcanvas {
      border: none !important;
      width: 200px;
      height: 400px;
    }
  </style>
</head>
<body>
  <!-- 首页 -->
  <!-- 头部导航栏部分 -->
  <header class="am-topbar am-topbar-fixed-top">
    <div class="am-container">
      <div class="am-collapse am-topbar-collapse">
        <ul class="am-nav am-nav-pills am-topbar-nav">
          <li class="am-active"><a href="/">首页</a></li>
          <li class=""><a href="/map">校区</a></li>
          <li class=""><a href="/class">班级</a></li>
          <li class=""><a href="/beweek">博文</a></li>
          <li class="new-entry"><a href="/going">学习计划</a></li>
        </ul>

        <%if (re[0]==0) {%>
        <div class="am-topbar-right" style="display:block">
          <a href="/login" class="am-btn-primary"><button class="am-btn am-btn-primary am-topbar-btn am-btn-sm"><span
                class="iconfont">&#xe60b;</span>
              登录</button></a>
        </div>
      </div>
    </div>
    <%}else {%>
    <div class="header-right" style="display:block">
      <ul style=" position: relative">
        <li><a href="javascript:;" class="arrows"><span class="iconfont span1">&#xe622;</span>首页</a>
        </li>
        <li class="myclass"><a href="javascript:;" class="class">
            <ul class="xiala_myclass">
              <li id="myclass">我的班级</li>
              <li id="updata">创建班级</li>
            </ul><span class="iconfont span2">&#xe602;</span>我的班级<i class="triangle iconfont">&#xe608;</i>
          </a></li>

        <li><a href="javascript:;" class="username" style=" position: relative">
            <span class="iconfont span3">&#xe604; <%= list.users_name %></span>
            <ul class="xialainfor">
              <li id="exit1">退出</li>
            </ul>

            <i class="iconfont triangle2">&#xe608;</i>
          </a></li>

      </ul>
    </div>
    </div>
    </div>

    <%}%>
  </header>
  <!-- 中间的所有内容 -->
  <div class="am-g am-container wrapper">

    <div class="am-u-md-12">
      <!-- 活跃班级部分 -->
      <div>
        <h1 class="titlebar am-margin-top-sm">
          活跃班级<span class="iconfont titlebar-icon">&#xe610;</span>
          <span class="titlebar-line"></span>
          <a href="/class" title="更多班级" class="titlebar-more">
            更多 &gt;
          </a>
        </h1>
        <ul class="am-avg-lg-3 am-margin-top-xl am-margin-bottom-lg showUser">
         </ul>
      </div>
      <!-- 作业博文 标题 -->
      <div id="blogpost">
        <h1 class="titlebar">
          作业博文<span class="iconfont titlebar-icon">&#xe60c;</span>
          <span class="titlebar-line"></span>
          <a href="/beposts" title="更多博文" class="titlebar-more">
            更多 &gt;
          </a>
        </h1>
        <div class="am-u-md-12">
          <ul class="am-list postUser">
            <li class="am-g am-list-item-desced am-list-item-thumbed am-list-item-thumb-bottom-right">
              <h3 class="am-list-item-hd">
                <a href="" target="_blank"></a>
              </h3>
              <div class="feed-avatar">
                <a href="" target="_blank"><img class="am-img-thumbnail" src=""></a>
              </div>
              <div class="avatar-item-text">
                <div class="am-list-item-text description"></div>
              </div>
              <div class="am-u-sm-12 am-text-sm">
                <div class="am-fr">
                  <i class="iconfont">&#xe61f;</i><a title="班级" href="" target="_blank">
                  </a>&nbsp;
                  <i class="iconfont">&#xe614;</i><a title="发布人" href="" target="_blank">
                  </a>&nbsp;
                  <span title="发布时间"><i class="iconfont">&#xe616;</i> </span>&nbsp;
                  <span title="评论"><i class="iconfont">&#xe606;</i> </span>&nbsp;
                  <span title="阅读"><i class="iconfont">&#xe641;</i> </span>
                </div>
              </div>
            </li>
          </ul>
        </div>
      </div>
      <!-- 作业博文 内容 -->
      <div id="homework">
        <!-- 作业动态标题 -->
        <h1 class="titlebar">
          作业动态<span class="iconfont titlebar-icon">&#xe603;</span>
          <span class="titlebar-line"></span>
          <a href="/behomework" title="更多作业" class="titlebar-more">
            更多 &gt;
          </a>
        </h1>
        <!-- 作业动态 内容 -->
        <div class="am-u-md-12">
          <ul class="am-list assignmentUser">
            <li class="am-g am-list-item-desced am-list-item-thumbed am-list-item-thumb-bottom-right">
              <h3 class="am-list-item-hd">
                <a href=""></a>
              </h3>
              <div class="feed-avatar">
                <a href=""><img class="am-img-thumbnail" src=""></a>
              </div>
              <div class="avatar-item-text">
                <div class="am-list-item-text description"></div>
              </div>
              <div class="am-u-sm-12 am-text-sm">
                <div class="am-fr">
                  <i class="iconfont">&#xe61f;</i><a title="班级" href=""></a>&nbsp;
                  <i class="iconfont">&#xe614;</i><a title="发布人" href=""></a>&nbsp;
                  <span title="发布时间"><i class="iconfont">&#xe616;</i> </span>&nbsp;
                  <span title="提交"><i class="iconfont">&#xe600;</i> </span>
                </div>
              </div>
            </li>
          </ul>
        </div>
      </div>
      <!-- 统计概览 -->
      <div id="overview">
        <h1 class="titlebar">
          统计概览<span class="iconfont titlebar-icon">&#xe637;</span>
          <span class="titlebar-line"></span>
        </h1>
        <ul class="am-avg-lg-4 am-margin-top-xl am-margin-bottom-lg">
          <li>
            <div class="am-gallery-item square-over-view">
              <h3 class="title">71</h3>
              <small>参与校区</small>
              <div class="iconfont">&#xe610;</div>
            </div>
          </li>
          <li>
            <div class="am-gallery-item square-over-view">
              <h3 class="title">334</h3>
              <small>创建班级</small>
              <div class="iconfont">&#xe639;</div>
            </div>
          </li>
          <li>
            <div class="am-gallery-item square-over-view">
              <h3 class="title">16300</h3>
              <small>加入成员</small>
              <div class="iconfont">&#xe6bf;</div>
            </div>
          </li>
          <li>
            <div class="am-gallery-item square-over-view">
              <h3 class="title">128745</h3>
              <small>累计博文</small>
              <div class="iconfont">&#xe60c;</div>
            </div>
          </li>
          <li>
            <div class="am-gallery-item square-over-view">
              <h3 class="title">2577</h3>
              <small>布置作业</small>
              <div class="iconfont">&#xe603;</div>
            </div>
          </li>
          <li>
            <div class="am-gallery-item square-over-view">
              <h3 class="title">106</h3>
              <small>发起投票</small>
              <div class="iconfont">&#xe63f;</div>
            </div>
          </li>
          <li>
            <div class="am-gallery-item square-over-view">
              <h3 class="title">208</h3>
              <small>发布公告</small>
              <div class="iconfont">&#xe638;</div>
            </div>
          </li>
          <li>
            <div class="am-gallery-item square-over-view">
              <h3 class="title">95402</h3>
              <small>历史评论</small>
              <div class="iconfont">&#xe62b;</div>
            </div>
          </li>
        </ul>
      </div>
    </div>
  </div>
  <!-- 底部 -->
  <footer class="footer">
    <p style='padding-bottom: 23px;'>
      Copyright &copy;2019 <a href="">Cnblogs, Inc.</a> Powered by ASP.NET Core on
      Linux. <a href=""><span class="iconfont">&#xe620;</span>问题反馈</a>&nbsp;<a href="">帮助文档</a>
    </p>
  </footer>
  <script src="https://cdn.jsdelivr.net/npm/live2d-widget@3.0.4/lib/L2Dwidget.min.js"></script>
  <%- include('./template/index-template.ejs')%>


    <script type="text/javascript">
      L2Dwidget.init();
    </script>
    <script src="./lib/template/template-web.js"></script>
    <script src="./lib/jquery-3.3.1.js"></script>

    <script>
      $.ajax({
        type: 'get',
        url: '/beindex',
        data: '',
        // 控制器接收到的信息 result
        success: function (result) {
          // 模板的写法              模板的id         模板的名字 ： 数据
          var str1 = template('index-template', {
            list: result
          });
          // console.log(str1)?
          $('.showUser').html(str1)
        }
      })


      $.ajax({
        type: 'get',
        url: '/postUser',
        data: '',
        success: function (data) {

          var str2 = template('post-template', {
            data: data
          });
          // console.log(str2)
          $('.postUser').html(str2);
        }
      })

      $.ajax({
        type: 'get',
        url: '/assignmentUser',
        data: '',
        success: function (data) {
          console.log(data)
          var str3 = template('assignmentUser-template', {
            data: data
          });
          $('.assignmentUser').html(str3);
        }
      })

      // 退出功能
      $('#exit1').on('click', function () {
        console.log(111)
        $.ajax({
          type: 'get',
          url: '/exit',
          data: '',
          success: function (data) {
            if (data.code = '123') {
              location.href = '/login'
            }

          }
        })
      })
      // 点击我的班级按钮 ，进入页面
      $('#myclass').on('click', function () {
        location.href = './myClassBlog'
      })
      // 点击创建班级，进入创建班级页面
      $('#updata').on('click', function () {
        location.href = '/register'
      })


    </script>
</body>

</html>